#include "widget.h"
#include "ui_widget.h"
#include <QDebug>
#include <QMouseEvent>

Widget::Widget(QWidget *parent)
    : QWidget(parent)
    , ui(new Ui::Widget)
{
    ui->setupUi(this);
    this->setStyleSheet(QString("background-color: rgb(0, 0, 0);"));
}

Widget::~Widget()
{
    delete ui;
}

void Widget::mouseDoubleClickEvent(QMouseEvent *e)
{
//    qDebug() << "doubleclick";
    qDebug() << e->type();
//    qDebug() << e->button();
    Qt::MouseButton bt = e->button();
    if(bt == Qt::LeftButton)
    {
        this->setStyleSheet(QString("background-color: rgb(255, 0, 0);"));
    }
    if(bt == Qt::RightButton)
    {
        this->setStyleSheet(QString("background-color: rgb(0, 255, 0);"));
    }
    if(bt == Qt::MiddleButton)
    {
        this->setStyleSheet(QString("background-color: rgb(0, 0, 255);"));
    }

//    qDebug() << e->buttons();
}

